<template>
  <p-modal
    v-model="visible"
    :title="title"
    :width="500"
    :dialog-style="{ top: '150px' }"
    :mask-closable="false"
    @ok="handleOk"
    @cancel="handleCancel"
  >
    <p-form-model
      ref="form"
      :model="form"
      :rules="rules"
      layout="inline"
      style="width: 100%"
    >
      <p-form-model-item label="会议名称" prop="meetName">
        <p-input v-model="form.meetName" style="width: 90%" />
      </p-form-model-item>
    </p-form-model>
  </p-modal>
</template>

<script>
// import { postOrganizationInfo } from '@/api/public.js';
import mixinTable from '@/mixins/mixin-table.js';

const defaultForm = {
  meetName: '',
};
export default {
  mixins: [mixinTable],
  props: {
    title: {
      type: String,
      default: '新增会议纪要',
    },
    value: {
      type: [String, Number],
      default: undefined,
    },
    visible: {
      type: Boolean,
      default: false,
    },
    info: {
      type: Object,
      default: () => ({}),
    },
    // meetName: {
    //   type: String,
    //   default: '',
    // },
    datasourceMy: {
      type: Array,
      default: () => [],
    },
    selectMy: {
      type: Array,
      default: () => [],
    },
    myKeys: {
      type: Array,
      default: () => [],
    },
  },
  data() {
    return {
      dataSource: [],
      form: {
        ...defaultForm,
      },
      columnKey: undefined,
      asc: undefined,
      rules: {
        meetName: [
          { required: true, message: '请输入会议名称！', trigger: 'blur' },
        ],
      },
    };
  },

  computed: {},
  watch: {},
  created() {},

  methods: {
    validate() {
      return new Promise((resolve) => {
        this.$refs.form.validate((valid) => {
          resolve(valid);
        });
      });
    },
    reset() {
      this.form = { ...defaultForm };
      this.paginationMixin.current = 1;
      this.paginationMixin.pageSize = 10;
      this.rowSelectionMixin.selectedRowKeys = [];
    },
    handleSearch() {
      this.visible = true;
    },
    handleCancel() {
      this.rowSelectionMixin.selectedRowKeys = [];
      this.form = {
        ...defaultForm,
      };
      this.$emit('update:visible', false);
    },
    async handleOk() {
      const valid = await this.validate();
      console.log('valid: ', valid);
      if (!valid) return new Promise(() => {});
      this.$emit('add-meet-record');
      this.handleCancel();
    },
  },
};
</script>

<style lang="less" scoped>
.content-container {
  width: 100%;
  display: flex;
  align-items: center;
  .content {
    display: flex;
    justify-content: center;
    flex: 1;
  }
}
.table-list-container {
  margin-top: 20px;
  height: 440px !important;
}

// .poros-form {
//   box-sizing: border-box;
//   background-color: #f7f7f8;
//   padding: 10px;
//   padding-bottom: 0px;
//   width: 100%;
// }
// .poros-form-item {
//   width: 25%;
//   margin-bottom: 10px;
// }
/deep/ .poros-form-item-control-wrapper {
  width: calc(100% - 70px);
}
/deep/ .poros-form-item {
  width: 90%;
  height: 32px;
}
/deep/ .poros-form-item-label {
  width: 70px;
}
</style>
